import PageRefresh, { usePageRefresh } from '@/component/pageRefresh';
import { List, Stepper, SearchBar } from "antd-mobile-v5";
import './index.less';

export default function IndexPage() {
    const pageRefresh = usePageRefresh<number>({
        func: (params) => {
            console.log("参数条件", params);
            return new Promise(res => {
                setTimeout(() => {
                    res({
                        total: 30,
                        data: Array(10).fill(0)
                    });
                }, 2000);
            })
        }
    });
    return (
        <div className='wrap' >
            <div style={{ padding: 24 }} >
                <SearchBar
                    onSearch={(e) => {
                        pageRefresh.refresh({ str: e })
                    }}
                    placeholder='请输入内容' />
            </div>
            <div style={{ flex: 1 }} >
                <PageRefresh
                    pageRefresh={pageRefresh}
                    renderItem={(item, index) => <List.Item key={index}>{index}</List.Item>}
                />
            </div>
        </div>
    );
}
